#pragma once
#include "PAKWriter.h"
#include "DeclarationManager.h"

namespace ds {

class LayerDecl : public ResourceDeclaration {

public:
	//LayerDecl() : ResourceDeclaration() {}
	LayerDecl(const std::string& name,bool active) : ResourceDeclaration(name) , m_Name(name) , m_Active(active) {}
	virtual ~LayerDecl() {}
	void parseCategory(Category* category) {}
	DeclarationType getType() const {
		return DT_LAYER;
	}	
	std::string& getName() {
		return m_Name;
	}
	bool isActive() const {
		return m_Active;
	}
private:
	std::string m_Name;
	bool m_Active;
};


class WorldDecl : public ResourceDeclaration {

typedef std::vector<LayerDecl*> LayerDeclarations;
public:
	WorldDecl() : ResourceDeclaration("World") {}
	virtual ~WorldDecl() {}
	void parseCategory(Category* category) {}
	DeclarationType getType() const {
		return DT_WORLD;
	}	
	void addLayerDecl(LayerDecl* ld) {
		m_Layers.push_back(ld);
	}
	size_t size() {
		return m_Layers.size();
	}
	LayerDecl* get(int index) {
		return m_Layers[index];
	}
private:
	LayerDeclarations m_Layers;
};

class LayerParser : public DeclarationParser {

public:
	LayerParser() : DeclarationParser() {}
	virtual ~LayerParser() {}
	ResourceDeclaration* loadTextFile(const ResourceFile& resourceFile);
	void createResource(ResourceDeclaration* declaration);
	void loadTextFile(const ResourceFile& resourceFile,DeclarationManager* declarationManager) {}
	DeclarationType getType() const {
		return DT_WORLD;
	}
	bool isSupported(const std::string& fileEnding) const {
		return fileEnding == ".layers";
	}
	bool isReloadable() const {
		return false;
	}	
};

}

